//
//  QuestionTableViewCell.m
//  one·一个  tyw
//
//  Created by tyw on 15/9/9.
//  Copyright (c) 2015年 tyw. All rights reserved.
//

#import "QuestionTableViewCell.h"
#import "DayNightLabel.h"

@implementation QuestionTableViewCell {
    DayNightLabel* label;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        label = [[DayNightLabel alloc] init];
        [label loadLabelColor];
        label.textAlignment = NSTextAlignmentLeft;
        label.font = [UIFont systemFontOfSize:14];
        label.numberOfLines = 0;
        [self.contentView addSubview:label];
    }
    
    return self;
}

- (void)setContentStr:(NSString *)contentStr {
    if (_contentStr != contentStr) {
        _contentStr = [contentStr copy];
        
        [self setNeedsLayout];
    }
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [label loadLabelColor];
    
    label.text = [NSString stringWithFormat:@"    %@", _contentStr];
    
    CGFloat height = [Tools contentSizeWithMaxWidth:kWidth-20 text:_contentStr fontOfSize:14].height;
    [label setFrame:CGRectMake(10, 0, kWidth-20, height+10)];
}

@end
